home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / helpscr2 / helpscrn.frm < prev    next >
Text File  |  1995-09-06  |  4KB  |  146 lines

  1. VERSION 2.00
  2. Begin Form HelpScrn 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Help Screen"
  5.    ClientHeight    =   4200
  6.    ClientLeft      =   975
  7.    ClientTop       =   2100
  8.    ClientWidth     =   7575
  9.    Height          =   4605
  10.    Icon            =   HELPSCRN.FRX:0000
  11.    Left            =   915
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4200
  14.    ScaleWidth      =   7575
  15.    Top             =   1755
  16.    Width           =   7695
  17.    Begin TextBox HoldBox 
  18.       Height          =   285
  19.       Left            =   480
  20.       MultiLine       =   -1  'True
  21.       TabIndex        =   4
  22.       Text            =   "Text1"
  23.       Top             =   240
  24.       Visible         =   0   'False
  25.       Width           =   1095
  26.    End
  27.    Begin ComboBox HelpTopic 
  28.       Height          =   300
  29.       Left            =   3120
  30.       TabIndex        =   0
  31.       Text            =   " "
  32.       Top             =   120
  33.       Width           =   4215
  34.    End
  35.    Begin CommandButton PrintHelp 
  36.       Caption         =   "&Print Topic"
  37.       Height          =   375
  38.       Left            =   5760
  39.       TabIndex        =   2
  40.       Top             =   3720
  41.       Width           =   1575
  42.    End
  43.    Begin CommandButton Return 
  44.       Caption         =   "&Exit Help"
  45.       Height          =   375
  46.       Left            =   240
  47.       TabIndex        =   1
  48.       Top             =   3720
  49.       Width           =   1215
  50.    End
  51.    Begin TextBox DisplayHelp 
  52.       Height          =   3015
  53.       Left            =   240
  54.       MultiLine       =   -1  'True
  55.       ScrollBars      =   2  'Vertical
  56.       TabIndex        =   3
  57.       TabStop         =   0   'False
  58.       Text            =   " "
  59.       Top             =   600
  60.       Width           =   7095
  61.    End
  62. End
  63. ' Helpscreen is a FREEWARE product.  While it is
  64. ' copywritten, you are encouraged to share it as
  65. ' long as you do not remove this message.
  66. ' HELPSCREEN written by Ed Crygier (C)opyright 1992
  67. ' Requires Visual Basic version 2.0 to incorporate
  68. ' in your program or VBRUN200.DLL to use as a stand
  69. ' alone program.
  70. ' Version 1.1
  71.  
  72. Const MaxTopics = 100
  73. Const MaxLines = 55
  74. Dim IndexTopic(MaxTopics)
  75. Dim HelpTexT(MaxTopics, MaxLines)
  76.  
  77. Sub Form_Load ()
  78. 'pass parameter 'HelpItem' to this program to make it text sensitive
  79. NL$ = Chr$(13) + Chr$(10)          'sets a carraige return
  80. TopicNbr = 0                       ' initialize
  81. FileNum = FreeFile                 ' find the next free file
  82.  
  83. Open "HelpFile.Txt" For Input As FileNum  'the help text
  84. ReadARecord:
  85.  If EOF(FileNum) Then GoTo LeaveHere
  86.    TopicNbr = TopicNbr + 1: LineNbr = 0
  87.    If TopicNbr > MaxTopics Then Close #FileNum: Exit Sub
  88.    Line Input #FileNum, IndexTopic(TopicNbr)
  89.    HelpTopic.AddItem IndexTopic(TopicNbr)
  90. MoreLines:
  91.    LineNbr = LineNbr + 1
  92.    If LineNbr > MaxLines Then
  93.       MsgBox "Number of lines exceeds 55 for Topic " + IndexTopic(TopicNbr) + ".  Add a '#' sign at line 55."
  94.       GoTo ReadARecord
  95.    End If
  96.    Line Input #FileNum, HelpTexT(TopicNbr, LineNbr)
  97.    If LTrim$(Left$(HelpTexT(TopicNbr, LineNbr), 1)) = "#" Then
  98.       GoTo ReadARecord
  99.    Else
  100.     HelpTexT(TopicNbr, LineNbr) = HelpTexT(TopicNbr, LineNbr) + NL$
  101.     GoTo MoreLines
  102.    End If
  103. LeaveHere:
  104. Close #FileNum
  105.  If (Val(HelpItem - 1 >= 0)) And (Val(HelpItem - 1 <= TopicNbr)) Then
  106.     HelpTopic.ListIndex = Str(HelpItem - 1)
  107.  Else
  108.     HelpTopic.ListIndex = 0
  109.  End If
  110. End Sub
  111.  
  112. Sub HelpTopic_Click ()
  113.  ShowIt
  114. End Sub
  115.  
  116. Sub PrintHelp_Click ()
  117. X = MsgBox("Insure printer is turned on.  OK to continue?", 36, "Print Topic")
  118. If X = 6 Then
  119.    Printer.Print IndexTopic(HelpTopic.ListIndex + 1)
  120.    Printer.Print DisplayHelp.Text
  121.    Printer.NewPage
  122.    Printer.EndDoc
  123. End If
  124. End Sub
  125.  
  126. Sub Return_Click ()
  127.  Erase IndexTopic
  128.  Erase HelpTexT
  129.  Unload HelpScrn
  130. End Sub
  131.  
  132. Sub ShowIt ()
  133. y = HelpTopic.ListIndex + 1
  134. z = 0
  135. DisplayHelp.Text = "": HoldBox.Text = ""
  136. ReadALine:
  137.   z = z + 1
  138.   If LTrim$(Left$(HelpTexT(y, z), 1)) = "#" Then
  139.      DisplayHelp.Text = HoldBox.Text
  140.     Exit Sub
  141.   End If
  142.   HoldBox.Text = HoldBox.Text + HelpTexT(y, z)
  143. GoTo ReadALine
  144. End Sub
  145.  
  146.